package org.bhavani.quicksort;

public class WithTwoArrays {

	public int[] part( int given[] , int piovtindex ,int temp[]){
		int k = 0;
		int j = given.length-1;
		for (int i = 0; i < given.length; i++) {

			if(given[i] < given[piovtindex]){

				temp[k] = given[i];
				k++;

			}else if(given[i] > given[piovtindex]){

				temp[j] = given[i];
				j--;

			}

		}
		if(k == j){
			temp[k] = given[piovtindex];
		}
		return temp;

	}
	void printArray(int given[]){
		for (int i = 0; i < given.length; i++) {
			System.out.println(given[i]);

		}
	}

	public static void main(String[] args) {
		int givenAr[] ={23,33,64,35,67};
		int temp[] = new int[5];
		WithTwoArrays quick = new WithTwoArrays();
		quick.part(givenAr, 3, temp);
		quick.printArray(temp);
	}



}
